﻿<ContentDialog
    x:Class="PuzzleModern.Phone.ParamsDialog"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:PuzzleModern"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d"
    Title="CUSTOM GAME"
    PrimaryButtonText="apply"  
    SecondaryButtonText="defaults..."
    PrimaryButtonClick="ContentDialog_PrimaryButtonClick"
    SecondaryButtonClick="ContentDialog_SecondaryButtonClick"
    Loaded="ContentDialog_Loaded"
    Unloaded="ContentDialog_Unloaded"
    >

    <!-- We have to copy the entire template from App.xaml to get a reference to the ScrollViewer -->
    <ContentDialog.Template>
        <ControlTemplate TargetType="ContentDialog">
            <Border x:Name="Container">
                <VisualStateManager.VisualStateGroups>
                    <VisualStateGroup x:Name="Orientation">
                        <VisualState x:Name="Portrait" />
                        <VisualState x:Name="Landscape">
                            <Storyboard>
                                <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Width" Storyboard.TargetName="ContentPanel" EnableDependentAnimation="True">
                                    <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ContentDialogContentLandscapeWidth}" />
                                </ObjectAnimationUsingKeyFrames>
                                <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="HorizontalAlignment" Storyboard.TargetName="ContentPanel">
                                    <DiscreteObjectKeyFrame KeyTime="0" Value="Left" />
                                </ObjectAnimationUsingKeyFrames>
                            </Storyboard>
                        </VisualState>
                    </VisualStateGroup>
                </VisualStateManager.VisualStateGroups>


                <Grid x:Name="LayoutRoot">
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto" />
                    </Grid.RowDefinitions>
                    <Border x:Name="BackgroundElement"
                            Background="{TemplateBinding Background}"
                            FlowDirection="LeftToRight">
                        <Border FlowDirection="{TemplateBinding FlowDirection}">
                            <Grid x:Name="ContentPanel">
                                <Grid.RowDefinitions>
                                    <RowDefinition Height="Auto" MinHeight="{ThemeResource ContentDialogTitleMinHeight}" />
                                    <RowDefinition Height="*" MinHeight="{ThemeResource ContentDialogContentMinHeight}" />

                                    <RowDefinition Height="Auto" />
                                </Grid.RowDefinitions>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="*" />
                                    <ColumnDefinition Width="*" />
                                </Grid.ColumnDefinitions>
                                <ContentControl x:Name="Title"
                                                Margin="{ThemeResource ContentDialogTitleMargin}"
                                                Content="{TemplateBinding Title}"
                                                ContentTemplate="{TemplateBinding TitleTemplate}"
                                                FontSize="{StaticResource TextStyleExtraLargeFontSize}"
                                                FontFamily="{ThemeResource PhoneFontFamilyNormal}"
                                                FontWeight="SemiBold"
                                                Grid.ColumnSpan="2" />
                                <ScrollViewer Grid.Row="1" x:Name="LayoutScrollViewer"
                                              Loaded="LayoutScrollViewer_Loaded"
                                              Grid.ColumnSpan="2" HorizontalScrollMode="Disabled" >
                                    <ContentPresenter x:Name="Content"
                                                      Margin="{ThemeResource ContentDialogContentMargin}"
                                                      ContentTemplate="{TemplateBinding ContentTemplate}"
                                                      Content="{TemplateBinding Content}"
                                                      FontSize="{StaticResource TextStyleLargeFontSize}"
                                                      FontFamily="{ThemeResource PhoneFontFamilyNormal}"
                                                      />
                                </ScrollViewer>
                                <Border x:Name="Button1Host" Padding="{ThemeResource ContentDialogButton1HostPadding}" Grid.Row="2" />
                                <Border x:Name="Button2Host" Padding="{ThemeResource ContentDialogButton2HostPadding}" Grid.Row="2" Grid.Column="1" />
                            </Grid>
                        </Border>
                    </Border>
                </Grid>
            </Border>
        </ControlTemplate>
    </ContentDialog.Template>
    
    <StackPanel>
        <StackPanel x:Name="ItemsPanel" />

        <Rectangle x:Name="KeyboardArea" Fill="Transparent" />
    </StackPanel>
</ContentDialog>
